################################################################################
#
# WangXun 10GbE PCI Express Linux Network Driver
# Copyright(c) 2015 - 2017 Beijing WangXun Technology Co., Ltd.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
# more details.
#
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
#
#
################################################################################

# common Makefile rules useful for out-of-tree Linux driver builds
#
# Usage: include configure
#
# After including, you probably want to add a minimum_kver_check call
#
# Required Variables:
# DRIVER
#   -- Set to the lowercase driver name

#####################
# Helpful functions #
#####################
CHNOS			:= 0	# default 0
				# kylinos	KYLIN
				# uosos 	UOS
				# euleros	EULER

NGBE_STATIC_ITR := 6756   # Maximum interrupts per second, per vector, (0,1,980-500000), default 6756
NGBE_LINK_RETRY := 0   # link down/100m, restart an to retry, default 0 not open
NGBE_POLL_LINK_STATUS:= 0
NGBE_PCIE_RECOVER:= 1   # pcie recovery, defalut to open
NGBE_RECOVER_CHECK := 1   # recover check log , default 1
NGBE_DIS_COMP_TIMEOUT := 1   # dis completion timeout, default 1 to dis
NGBE_1588_PPS_LEVEL := 1  # pps output level(0 or 1), default 1(high level)
NGBE_1588_PPS_WIDTH := 120  #pps width(ms),(10-900ms), default 120ms.
NGBE_1588_TOD_ENABLE := 1 # output tod by fw, default 1(enabled)

NGBE_STORM_INTERVAL := 100  # storm control window interval: window interval = 10us * NGBE_STORM_INTERVAL ,default 1ms(100 * 10us = 1ms), range:1~1023
NGBE_STORM_UC := 0  # uc storm control: 0:off(default), 1:destination unresolved and sent to default VSI unicast packets as broadcast packet
NGBE_STORM_BC := 0  # bc storm control: 0:off(default), 1:pre window, 2:cur window, 3:both cur&prev
NGBE_STORM_BC_THRE := 100  # Upper threshold of receive bc packets per window,  range:1~65535
NGBE_STORM_MC := 0  # mc storm control: 0:off(default), 1:pre window, 2:cur window, 3:both cur&prev
NGBE_STORM_MC_THRE := 100  # Upper threshold of receive mc packets per window, range:1~65535
###########################################################################
ifeq (${CHNOS}, UOS)
EXTRA_CFLAGS += -DCONFIG_UOS_KERNEL=$(CONFIG_UOS_KERNEL)
endif
ifeq ($(CHNOS), EULER)
EXTRA_CFLAGS += -DCONFIG_EULER_KERNEL=$(CONFIG_EULER_KERNEL)
endif
ifeq ($(CHNOS), KYLIN)
EXTRA_CFLAGS += -DCONFIG_KYLIN_KERNEL=$(CONFIG_KYLIN_KERNEL)
endif

EXTRA_CFLAGS += -DNGBE_POLL_LINK_STATUS=$(NGBE_POLL_LINK_STATUS)
EXTRA_CFLAGS += -DNGBE_STATIC_ITR=$(NGBE_STATIC_ITR)
EXTRA_CFLAGS += -DNGBE_LINK_RETRY=$(NGBE_LINK_RETRY)

EXTRA_CFLAGS += -DNGBE_PCIE_RECOVER=$(NGBE_PCIE_RECOVER)
EXTRA_CFLAGS += -DNGBE_RECOVER_CHECK=$(NGBE_RECOVER_CHECK)
EXTRA_CFLAGS += -DNGBE_DIS_COMP_TIMEOUT=$(NGBE_DIS_COMP_TIMEOUT)

EXTRA_CFLAGS += -DNGBE_1588_PPS_LEVEL=$(NGBE_1588_PPS_LEVEL)
EXTRA_CFLAGS += -DNGBE_1588_PPS_WIDTH=$(NGBE_1588_PPS_WIDTH)
EXTRA_CFLAGS += -DNGBE_1588_TOD_ENABLE=$(NGBE_1588_TOD_ENABLE)

EXTRA_CFLAGS += -DNGBE_STORM_INTERVAL=$(NGBE_STORM_INTERVAL)
EXTRA_CFLAGS += -DNGBE_STORM_UC=$(NGBE_STORM_UC)
EXTRA_CFLAGS += -DNGBE_STORM_BC=$(NGBE_STORM_BC)
EXTRA_CFLAGS += -DNGBE_STORM_BC_THRE=$(NGBE_STORM_BC_THRE)
EXTRA_CFLAGS += -DNGBE_STORM_MC=$(NGBE_STORM_MC)
EXTRA_CFLAGS += -DNGBE_STORM_MC_THRE=$(NGBE_STORM_MC_THRE)
